<?php
/**
 * Created by PhpStorm.
 * User: dev
 * Date: 7/10/14
 * Time: 1:07 PM
 */

class Location_Widget_Filter_Controller extends Base_Controller {

    public $restful = true;

    public function __construct()
    {
        parent::__construct();
        //--Your Code --//
    }


    public function get_index($location){

        $ctr = count(URI::$segments);
        for($i=2; $i<=$ctr ; $i++){
            $cURL .= URI::segment($i).'/';
        }
        $data['cURL'] = $cURL;

        $loc = Locations::find($location);
        if($loc){
            $data['widget_location'] = $loc->name;
            $data['widget_location_child'] = Hierarchy::get_ancestors('locations',$loc->id);
        }else{
            $data['widget_location'] = Location::get();
            $data['widget_location_child'] = Locations::parent(0)->get();
        }



        return View::make('Location::widget.filter',$data);
    }
}